1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module gio.TlsClientConnectionT; 26 27 public import gio.IOStream; 28 public import gio.SocketConnectableIF; 29 public import gio.c.functions; 30 public import gio.c.types; 31 public import glib.ConstructionException; 32 public import glib.ErrorG; 33 public import glib.GException; 34 public import glib.ListG; 35 public import gobject.ObjectG; 36 37 38 /** 39 * #GTlsClientConnection is the client-side subclass of 40 * #GTlsConnection, representing a client-side TLS connection. 41 * 42 * Since: 2.28 43 */ 44 public template TlsClientConnectionT(TStruct) 45 { 46 /** Get the main Gtk struct */ 47 public GTlsClientConnection* getTlsClientConnectionStruct(bool transferOwnership = false) 48 { 49 if (transferOwnership) 50 ownedRef = false; 51 return cast(GTlsClientConnection*)getStruct(); 52 } 53 54 55 /** 56 * Possibly copies session state from one connection to another, for use 57 * in TLS session resumption. This is not normally needed, but may be 58 * used when the same session needs to be used between different 59 * endpoints, as is required by some protocols, such as FTP over TLS. 60 * @source should have already completed a handshake and, since TLS 1.3, 61 * it should have been used to read data at least once. @conn should not 62 * have completed a handshake. 63 * 64 * It is not possible to know whether a call to this function will 65 * actually do anything. Because session resumption is normally used 66 * only for performance benefit, the TLS backend might not implement 67 * this function. Even if implemented, it may not actually succeed in 68 * allowing @conn to resume @source's TLS session, because the server 69 * may not have sent a session resumption token to @source, or it may 70 * refuse to accept the token from @conn. There is no way to know 71 * whether a call to this function is actually successful. 72 * 73 * Using this function is not required to benefit from session 74 * resumption. If the TLS backend supports session resumption, the 75 * session will be resumed automatically if it is possible to do so 76 * without weakening the privacy guarantees normally provided by TLS, 77 * without need to call this function. For example, with TLS 1.3, 78 * a session ticket will be automatically copied from any 79 * #GTlsClientConnection that has previously received session tickets 80 * from the server, provided a ticket is available that has not 81 * previously been used for session resumption, since session ticket 82 * reuse would be a privacy weakness. Using this function causes the 83 * ticket to be copied without regard for privacy considerations. 84 * 85 * Params: 86 * source = a #GTlsClientConnection 87 * 88 * Since: 2.46 89 */ 90 public void copySessionState(TlsClientConnectionIF source) 91 { 92 g_tls_client_connection_copy_session_state(getTlsClientConnectionStruct(), (source is null) ? null : source.getTlsClientConnectionStruct()); 93 } 94 95 /** 96 * Gets the list of distinguished names of the Certificate Authorities 97 * that the server will accept certificates from. This will be set 98 * during the TLS handshake if the server requests a certificate. 99 * Otherwise, it will be %NULL. 100 * 101 * Each item in the list is a #GByteArray which contains the complete 102 * subject DN of the certificate authority. 103 * 104 * Returns: the list of 105 * CA DNs. You should unref each element with g_byte_array_unref() and then 106 * the free the list with g_list_free(). 107 * 108 * Since: 2.28 109 */ 110 public ListG getAcceptedCas() 111 { 112 auto __p = g_tls_client_connection_get_accepted_cas(getTlsClientConnectionStruct()); 113 114 if(__p is null) 115 { 116 return null; 117 } 118 119 return new ListG(cast(GList*) __p, true); 120 } 121 122 /** 123 * Gets @conn's expected server identity 124 * 125 * Returns: a #GSocketConnectable describing the 126 * expected server identity, or %NULL if the expected identity is not 127 * known. 128 * 129 * Since: 2.28 130 */ 131 public SocketConnectableIF getServerIdentity() 132 { 133 auto __p = g_tls_client_connection_get_server_identity(getTlsClientConnectionStruct()); 134 135 if(__p is null) 136 { 137 return null; 138 } 139 140 return ObjectG.getDObject!(SocketConnectableIF)(cast(GSocketConnectable*) __p); 141 } 142 143 /** 144 * SSL 3.0 is no longer supported. See 145 * g_tls_client_connection_set_use_ssl3() for details. 146 * 147 * Deprecated: SSL 3.0 is insecure. 148 * 149 * Returns: %FALSE 150 * 151 * Since: 2.28 152 */ 153 public bool getUseSsl3() 154 { 155 return g_tls_client_connection_get_use_ssl3(getTlsClientConnectionStruct()) != 0; 156 } 157 158 /** 159 * Gets @conn's validation flags 160 * 161 * This function does not work as originally designed and is impossible 162 * to use correctly. See #GTlsClientConnection:validation-flags for more 163 * information. 164 * 165 * Deprecated: Do not attempt to ignore validation errors. 166 * 167 * Returns: the validation flags 168 * 169 * Since: 2.28 170 */ 171 public GTlsCertificateFlags getValidationFlags() 172 { 173 return g_tls_client_connection_get_validation_flags(getTlsClientConnectionStruct()); 174 } 175 176 /** 177 * Sets @conn's expected server identity, which is used both to tell 178 * servers on virtual hosts which certificate to present, and also 179 * to let @conn know what name to look for in the certificate when 180 * performing %G_TLS_CERTIFICATE_BAD_IDENTITY validation, if enabled. 181 * 182 * Params: 183 * identity = a #GSocketConnectable describing the expected server identity 184 * 185 * Since: 2.28 186 */ 187 public void setServerIdentity(SocketConnectableIF identity) 188 { 189 g_tls_client_connection_set_server_identity(getTlsClientConnectionStruct(), (identity is null) ? null : identity.getSocketConnectableStruct()); 190 } 191 192 /** 193 * Since GLib 2.42.1, SSL 3.0 is no longer supported. 194 * 195 * From GLib 2.42.1 through GLib 2.62, this function could be used to 196 * force use of TLS 1.0, the lowest-supported TLS protocol version at 197 * the time. In the past, this was needed to connect to broken TLS 198 * servers that exhibited protocol version intolerance. Such servers 199 * are no longer common, and using TLS 1.0 is no longer considered 200 * acceptable. 201 * 202 * Since GLib 2.64, this function does nothing. 203 * 204 * Deprecated: SSL 3.0 is insecure. 205 * 206 * Params: 207 * useSsl3 = a #gboolean, ignored 208 * 209 * Since: 2.28 210 */ 211 public void setUseSsl3(bool useSsl3) 212 { 213 g_tls_client_connection_set_use_ssl3(getTlsClientConnectionStruct(), useSsl3); 214 } 215 216 /** 217 * Sets @conn's validation flags, to override the default set of 218 * checks performed when validating a server certificate. By default, 219 * %G_TLS_CERTIFICATE_VALIDATE_ALL is used. 220 * 221 * This function does not work as originally designed and is impossible 222 * to use correctly. See #GTlsClientConnection:validation-flags for more 223 * information. 224 * 225 * Deprecated: Do not attempt to ignore validation errors. 226 * 227 * Params: 228 * flags = the #GTlsCertificateFlags to use 229 * 230 * Since: 2.28 231 */ 232 public void setValidationFlags(GTlsCertificateFlags flags) 233 { 234 g_tls_client_connection_set_validation_flags(getTlsClientConnectionStruct(), flags); 235 } 236 }